<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>OpenFOAM 中的边界条件（二） | Giskard&#39;s CFD Learning Tricks</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="本篇在上一篇的基础上来解读 OpenFOAM 中的基础边界条件。基础边界条件一般包括三类，一是Dirichlet 边界，二是 Neumann 边界，三是混合 Dirichlet 和 Neumann 的边界。">
<meta property="og:type" content="article">
<meta property="og:title" content="OpenFOAM 中的边界条件（二）">
<meta property="og:url" content="http://xiaopingqiu.github.io/2016/04/02/Boundary-conditions-in-OpenFOAM2/index.html">
<meta property="og:site_name" content="Giskard's CFD Learning Tricks">
<meta property="og:description" content="本篇在上一篇的基础上来解读 OpenFOAM 中的基础边界条件。基础边界条件一般包括三类，一是Dirichlet 边界，二是 Neumann 边界，三是混合 Dirichlet 和 Neumann 的边界。">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="OpenFOAM 中的边界条件（二）">
<meta name="twitter:description" content="本篇在上一篇的基础上来解读 OpenFOAM 中的基础边界条件。基础边界条件一般包括三类，一是Dirichlet 边界，二是 Neumann 边界，三是混合 Dirichlet 和 Neumann 的边界。">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css" type="text/css">
  
<!-- Google Analytics -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

##ga('create', '[object Object]', 'auto');
ga('create', 'UA-62501686-1', 'auto');
ga('send', 'pageview');

</script>
<!-- End Google Analytics -->


</head>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Giskard&#39;s CFD Learning Tricks</a>
      </h1>
      
        <h2 id="subtitle-wrap">
          <a href="/" id="subtitle">CFD and Scientific Computing</a>
        </h2>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
          <a class="main-nav-link" href="/atom.xml">Rss</a>
        
          <a class="main-nav-link" href="/about">About</a>
        
      </nav>
      <nav id="sub-nav">
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="q" value="site:http://xiaopingqiu.github.io"></form>
      </div>
    </div>
  </div>
</header>

      <div class="outer">
        <section id="main"><article id="post-Boundary-conditions-in-OpenFOAM2" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2016/04/02/Boundary-conditions-in-OpenFOAM2/" class="article-date">
  <time datetime="2016-04-02T08:40:43.000Z" itemprop="datePublished">2016-04-02</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/OpenFOAM/">OpenFOAM</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      OpenFOAM 中的边界条件（二）
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>本篇在上一篇的基础上来解读 OpenFOAM 中的基础边界条件。基础边界条件一般包括三类，一是Dirichlet 边界，二是 Neumann 边界，三是混合 Dirichlet 和 Neumann 的边界。</p>
<a id="more"></a>
<h5 id="1-_fixedValue">1. fixedValue</h5><p>这个是 OpenFOAM 中的 Dirichlet 边界条件。</p>
<ul>
<li>构造函数<figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">fixedValueFvPatchField&lt;<span class="type">Type</span>&gt;::fixedValueFvPatchField</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> fvPatch&amp; p,</span><br><span class="line">    <span class="keyword">const</span> <span class="type">DimensionedField</span>&lt;<span class="type">Type</span>, volMesh&gt;&amp; iF,</span><br><span class="line">    <span class="keyword">const</span> dictionary&amp; dict</span><br><span class="line">)</span><br><span class="line">:</span><br><span class="line">    fvPatchField&lt;<span class="type">Type</span>&gt;(p, iF, dict, <span class="literal">true</span>)</span><br><span class="line">&#123;&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>熟悉 OpenFOAM 的人都知道， <code>fixedValue</code> 这个边界条件需要用 <code>value</code> 关键字来指定边界的值。<code>value</code> 这个关键字是通过 <code>DimensionedField</code> 类来处理的。 <code>DimensionedField</code> 这个类将读取 <code>value</code> 关键字对应的场的值用来初始化边界上的值。</p>
<ul>
<li>coefficients<figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedValueFvPatchField&lt;<span class="type">Type</span>&gt;::valueInternalCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt;</span><br><span class="line">    (</span><br><span class="line">        new <span class="type">Field</span>&lt;<span class="type">Type</span>&gt;(this-&gt;size(), pTraits&lt;<span class="type">Type</span>&gt;::zero)</span><br><span class="line">    );</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedValueFvPatchField&lt;<span class="type">Type</span>&gt;::valueBoundaryCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> *this;</span><br><span class="line">&#125;</span><br><span class="line">这里 <span class="string">"*this"</span> 表示类本身，即当前边界上的值。这个值在上面的构造函数中进行了初始化，所以，可以理解为 valueBoundaryCoeffs 函数返回的正是关键字 <span class="string">"value"</span> 所对应的值。</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedValueFvPatchField&lt;<span class="type">Type</span>&gt;::gradientInternalCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> -pTraits&lt;<span class="type">Type</span>&gt;::one*this-&gt;patch().deltaCoeffs();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedValueFvPatchField&lt;<span class="type">Type</span>&gt;::gradientBoundaryCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> this-&gt;patch().deltaCoeffs()*(*this);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>$$<br>\begin{align}<br>valueInternalCoeffs &amp; = 0 \\<br>valueBoundaryCoeffs &amp; = value \\<br>gradientInternalCoeffs &amp; = -delta \\<br>gradientBoundaryCoeffs &amp; = delta* value<br>\end{align}<br>$$</p>
<p>其中 $delta$ 为面心与面所属网格中心的距离的倒数。<br>从上述系数，可以知道，fixedValue 边界条件对边界的值和梯度值的计算为如下：<br>$$<br>\begin{align}<br>x_p &amp; = value \\<br>\nabla x_p &amp; = - delta \cdot x_C + delta \cdot value = (value - x_C) \cdot delta<br>\end{align}<br>$$<br>这与预期是一致的。</p>
<h5 id="2-_zeroGradient">2. zeroGradient</h5><p>这个是 OpenFOAM 中的一种特殊的 Neumann 边界条件，即边界的梯度为零。</p>
<ul>
<li>evaluate 函数<figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line"><span class="literal">void</span> zeroGradientFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>(const Pstream<span class="tag">::commsTypes</span>)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="subst">!</span>this<span class="subst">-&gt;</span>updated())</span><br><span class="line">    &#123;</span><br><span class="line">        this<span class="subst">-&gt;</span>updateCoeffs();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    fvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::operator</span><span class="subst">==</span>(this<span class="subst">-&gt;</span>patchInternalField());</span><br><span class="line">    fvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>注意，这里的 <code>operator==</code> 与 <code>operator=</code> 的作用是一样的，都是赋值运算，而不是比较。</p>
<ul>
<li>coefficients<figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line">tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span> zeroGradientFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::valueInternalCoeffs</span></span><br><span class="line">(</span><br><span class="line">    const tmp<span class="subst">&lt;</span>scalarField<span class="subst">&gt;&amp;</span></span><br><span class="line">) const</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span></span><br><span class="line">    (</span><br><span class="line">        <span class="literal">new</span> Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span>(this<span class="subst">-&gt;</span>size(), pTraits<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::one</span>)</span><br><span class="line">    );</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line">tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span> zeroGradientFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::valueBoundaryCoeffs</span></span><br><span class="line">(</span><br><span class="line">    const tmp<span class="subst">&lt;</span>scalarField<span class="subst">&gt;&amp;</span></span><br><span class="line">) const</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span></span><br><span class="line">    (</span><br><span class="line">        <span class="literal">new</span> Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span>(this<span class="subst">-&gt;</span>size(), pTraits<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::zero</span>)</span><br><span class="line">    );</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line">tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span> zeroGradientFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::gradientInternalCoeffs</span>() const</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span></span><br><span class="line">    (</span><br><span class="line">        <span class="literal">new</span> Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span>(this<span class="subst">-&gt;</span>size(), pTraits<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::zero</span>)</span><br><span class="line">    );</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line">tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span> zeroGradientFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::gradientBoundaryCoeffs</span>() const</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp<span class="subst">&lt;</span>Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span> <span class="subst">&gt;</span></span><br><span class="line">    (</span><br><span class="line">        <span class="literal">new</span> Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span>(this<span class="subst">-&gt;</span>size(), pTraits<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::zero</span>)</span><br><span class="line">    );</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>$$<br>\begin{align}<br>valueInternalCoeffs &amp; = 1 \\<br>valueBoundaryCoeffs &amp; = 0 \\<br>gradientInternalCoeffs &amp; = 0 \\<br>gradientBoundaryCoeffs &amp; = 0<br>\end{align}<br>$$</p>
<p>从上述系数，可以知道，fixedValue 边界条件对边界的值和梯度值的计算为如下：</p>
<p>$$<br>\begin{align}<br>x_p &amp; = x_C \\<br>\nabla x_p &amp; = 0<br>\end{align}<br>$$<br>这与预期是一致的。</p>
<h5 id="3-_fixedGradient">3. fixedGradient</h5><p>这个是 OpenFOAM 中的 Neumann 边界条件，可以指定边界上的梯度值。</p>
<ul>
<li>构造函数<figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">fixedGradientFvPatchField&lt;<span class="type">Type</span>&gt;::fixedGradientFvPatchField</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> fvPatch&amp; p,</span><br><span class="line">    <span class="keyword">const</span> <span class="type">DimensionedField</span>&lt;<span class="type">Type</span>, volMesh&gt;&amp; iF,</span><br><span class="line">    <span class="keyword">const</span> dictionary&amp; dict</span><br><span class="line">)</span><br><span class="line">:</span><br><span class="line">    fvPatchField&lt;<span class="type">Type</span>&gt;(p, iF, dict),</span><br><span class="line">    gradient_(<span class="string">"gradient"</span>, dict, p.size())</span><br><span class="line">&#123;</span><br><span class="line">    evaluate();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>需要读取关键字 “gradient” 对应的值来初始化变量 <code>gradient_</code>。</p>
<ul>
<li>evaluate 函数<figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line"><span class="literal">void</span> fixedGradientFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>(const Pstream<span class="tag">::commsTypes</span>)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="subst">!</span>this<span class="subst">-&gt;</span>updated())</span><br><span class="line">    &#123;</span><br><span class="line">        this<span class="subst">-&gt;</span>updateCoeffs();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::operator</span><span class="subst">=</span></span><br><span class="line">    (</span><br><span class="line">        this<span class="subst">-&gt;</span>patchInternalField() <span class="subst">+</span> gradient_/this<span class="subst">-&gt;</span>patch()<span class="built_in">.</span>deltaCoeffs()</span><br><span class="line">    );</span><br><span class="line"></span><br><span class="line">    fvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>$$<br>x_p = x_C + \frac{gradient} {delta}<br>$$<br>其中 $delta$ 为面心与面所属网格中心的距离的倒数。</p>
<ul>
<li>coefficients<figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedGradientFvPatchField&lt;<span class="type">Type</span>&gt;::valueInternalCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt;(new <span class="type">Field</span>&lt;<span class="type">Type</span>&gt;(this-&gt;size(), pTraits&lt;<span class="type">Type</span>&gt;::one));</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedGradientFvPatchField&lt;<span class="type">Type</span>&gt;::valueBoundaryCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> gradient()/this-&gt;patch().deltaCoeffs();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedGradientFvPatchField&lt;<span class="type">Type</span>&gt;::</span><br><span class="line">gradientInternalCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt;</span><br><span class="line">    (</span><br><span class="line">        new <span class="type">Field</span>&lt;<span class="type">Type</span>&gt;(this-&gt;size(), pTraits&lt;<span class="type">Type</span>&gt;::zero)</span><br><span class="line">    );</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; fixedGradientFvPatchField&lt;<span class="type">Type</span>&gt;::</span><br><span class="line">gradientBoundaryCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> gradient();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>$$<br>\begin{align}<br>valueInternalCoeffs &amp; = 1 \\<br>valueBoundaryCoeffs &amp; = \tfrac{gradient}{delta} \\<br>gradientInternalCoeffs &amp; = 0 \\<br>gradientBoundaryCoeffs &amp; = gradient<br>\end{align}<br>$$</p>
<h5 id="4-_mixed">4. mixed</h5><p>这是 OpenFOAM 中的混合边界条件。</p>
<ul>
<li>构造函数<figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">mixedFvPatchField&lt;<span class="type">Type</span>&gt;::mixedFvPatchField</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> fvPatch&amp; p,</span><br><span class="line">    <span class="keyword">const</span> <span class="type">DimensionedField</span>&lt;<span class="type">Type</span>, volMesh&gt;&amp; iF,</span><br><span class="line">    <span class="keyword">const</span> dictionary&amp; dict</span><br><span class="line">)</span><br><span class="line">:</span><br><span class="line">    fvPatchField&lt;<span class="type">Type</span>&gt;(p, iF, dict),</span><br><span class="line">    refValue_(<span class="string">"refValue"</span>, dict, p.size()),</span><br><span class="line">    refGrad_(<span class="string">"refGradient"</span>, dict, p.size()),</span><br><span class="line">    valueFraction_(<span class="string">"valueFraction"</span>, dict, p.size())</span><br><span class="line">&#123;</span><br><span class="line">    evaluate();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>需要读取三个参数。</p>
<ul>
<li>evaluate<figure class="highlight lasso"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">template<span class="subst">&lt;</span>class <span class="keyword">Type</span><span class="subst">&gt;</span></span><br><span class="line"><span class="literal">void</span> mixedFvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>(const Pstream<span class="tag">::commsTypes</span>)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">if</span> (<span class="subst">!</span>this<span class="subst">-&gt;</span>updated())</span><br><span class="line">    &#123;</span><br><span class="line">        this<span class="subst">-&gt;</span>updateCoeffs();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    Field<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::operator</span><span class="subst">=</span></span><br><span class="line">    (</span><br><span class="line">        valueFraction_<span class="subst">*</span>refValue_</span><br><span class="line">      <span class="subst">+</span></span><br><span class="line">        (<span class="number">1.0</span> <span class="subst">-</span> valueFraction_)<span class="subst">*</span></span><br><span class="line">        (</span><br><span class="line">            this<span class="subst">-&gt;</span>patchInternalField()</span><br><span class="line">          <span class="subst">+</span> refGrad_/this<span class="subst">-&gt;</span>patch()<span class="built_in">.</span>deltaCoeffs()</span><br><span class="line">        )</span><br><span class="line">    );</span><br><span class="line">    fvPatchField<span class="subst">&lt;</span><span class="keyword">Type</span><span class="subst">&gt;</span><span class="tag">::evaluate</span>();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>$$<br>x_p = valueFraction \cdot refValue + (1-valueFraction) \cdot (x_C + \frac{refGrad}{delta})<br>$$</p>
<ul>
<li>coefficients<figure class="highlight nimrod"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; mixedFvPatchField&lt;<span class="type">Type</span>&gt;::valueInternalCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> <span class="type">Type</span>(pTraits&lt;<span class="type">Type</span>&gt;::one)*(<span class="number">1</span>.<span class="number">0</span> - valueFraction_);</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; mixedFvPatchField&lt;<span class="type">Type</span>&gt;::valueBoundaryCoeffs</span><br><span class="line">(</span><br><span class="line">    <span class="keyword">const</span> tmp&lt;scalarField&gt;&amp;</span><br><span class="line">) <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span></span><br><span class="line">         valueFraction_*refValue_</span><br><span class="line">       + (<span class="number">1</span>.<span class="number">0</span> - valueFraction_)*refGrad_/this-&gt;patch().deltaCoeffs();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; mixedFvPatchField&lt;<span class="type">Type</span>&gt;::gradientInternalCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span> -<span class="type">Type</span>(pTraits&lt;<span class="type">Type</span>&gt;::one)*valueFraction_*this-&gt;patch().deltaCoeffs();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">template</span>&lt;class <span class="type">Type</span>&gt;</span><br><span class="line">tmp&lt;<span class="type">Field</span>&lt;<span class="type">Type</span>&gt; &gt; mixedFvPatchField&lt;<span class="type">Type</span>&gt;::gradientBoundaryCoeffs() <span class="keyword">const</span></span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">return</span></span><br><span class="line">        valueFraction_*this-&gt;patch().deltaCoeffs()*refValue_</span><br><span class="line">      + (<span class="number">1</span>.<span class="number">0</span> - valueFraction_)*refGrad_;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>$$<br>\begin{align}<br>valueInternalCoeffs &amp; = 1-valueFraction \\<br>valueBoundaryCoeffs &amp; = valueFraction \cdot refValue + (1-valueFraction) \cdot \tfrac{refGrad}{delta} \\<br>gradientInternalCoeffs &amp; = -valueFraction \cdot delta \\<br>gradientBoundaryCoeffs &amp; = valueFraction \cdot refValue \cdot delta + (1-valueFraction) \cdot refGrad<br>\end{align}<br>$$</p>
<p>附注：本篇中所有的下标 $p$ 都表示当前边界（present boundary patch），下标 $C$ 表示当前边界所属的网格的中心。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://xiaopingqiu.github.io/2016/04/02/Boundary-conditions-in-OpenFOAM2/" data-id="cj2lay37u006jkkmbhe470mz8" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Boundary-conditions/">Boundary conditions</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2016/04/02/Boundary-conditions-in-OpenFOAM3/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          OpenFOAM 中的边界条件（三）
        
      </div>
    </a>
  
  
    <a href="/2016/04/02/Boundary-conditions-in-OpenFOAM1/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">OpenFOAM 中的边界条件（一）</div>
    </a>
  
</nav>

  
</article>


<section id="comments">
  <!-- 多说评论框 start -->
  <div class="ds-thread" data-thread-key="post-Boundary-conditions-in-OpenFOAM2" data-title="OpenFOAM 中的边界条件（二）" data-url="http://xiaopingqiu.github.io/2016/04/02/Boundary-conditions-in-OpenFOAM2/"></div>
  <!-- 多说评论框 end -->
  <!-- 多说公共JS代码 start (一个网页只需插入一次) -->
  <script type="text/javascript">
  var duoshuoQuery = {short_name:"xiaopingqiu"};
	(function() {
		var ds = document.createElement('script');
		ds.type = 'text/javascript';ds.async = true;
		ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
		ds.charset = 'UTF-8';
		(document.getElementsByTagName('head')[0] 
		 || document.getElementsByTagName('body')[0]).appendChild(ds);
	})();
	</script>
  <!-- 多说公共JS代码 end -->
</section>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/C/">C++</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/DEM/">DEM</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/OpenFOAM/">OpenFOAM</a><span class="category-list-count">44</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Paraview/">Paraview</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/swak4Foam/">swak4Foam</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/test/">test</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/vim/">vim</a><span class="category-list-count">1</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Boundary-conditions/">Boundary conditions</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/">C++</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CentOS/">CentOS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Code-Explained/">Code Explained</a><span class="tag-list-count">29</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/LES/">LES</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/LIGGGHTS/">LIGGGHTS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ODE/">ODE</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/OpenFOAM/">OpenFOAM</a><span class="tag-list-count">20</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Postprocessing/">Postprocessing</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Preprocessing/">Preprocessing</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RTS/">RTS</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TIL/">TIL</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Windows/">Windows</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/fvOptions/">fvOptions</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/groovyBC/">groovyBC</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/paraview/">paraview</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/thermophysicalModels/">thermophysicalModels</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/turbulence-model/">turbulence model</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wall-functions/">wall functions</a><span class="tag-list-count">4</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Boundary-conditions/" style="font-size: 15.56px;">Boundary conditions</a><a href="/tags/C/" style="font-size: 11.11px;">C++</a><a href="/tags/CentOS/" style="font-size: 10px;">CentOS</a><a href="/tags/Code-Explained/" style="font-size: 20px;">Code Explained</a><a href="/tags/LES/" style="font-size: 10px;">LES</a><a href="/tags/LIGGGHTS/" style="font-size: 10px;">LIGGGHTS</a><a href="/tags/ODE/" style="font-size: 10px;">ODE</a><a href="/tags/OpenFOAM/" style="font-size: 18.89px;">OpenFOAM</a><a href="/tags/Postprocessing/" style="font-size: 17.78px;">Postprocessing</a><a href="/tags/Preprocessing/" style="font-size: 11.11px;">Preprocessing</a><a href="/tags/RTS/" style="font-size: 12.22px;">RTS</a><a href="/tags/TIL/" style="font-size: 10px;">TIL</a><a href="/tags/Windows/" style="font-size: 10px;">Windows</a><a href="/tags/fvOptions/" style="font-size: 11.11px;">fvOptions</a><a href="/tags/groovyBC/" style="font-size: 10px;">groovyBC</a><a href="/tags/paraview/" style="font-size: 10px;">paraview</a><a href="/tags/test/" style="font-size: 11.11px;">test</a><a href="/tags/thermophysicalModels/" style="font-size: 14.44px;">thermophysicalModels</a><a href="/tags/turbulence-model/" style="font-size: 16.67px;">turbulence model</a><a href="/tags/vim/" style="font-size: 10px;">vim</a><a href="/tags/wall-functions/" style="font-size: 13.33px;">wall functions</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/">五月 2017</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">八月 2016</a><span class="archive-list-count">8</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/06/">六月 2016</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/05/">五月 2016</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">四月 2016</a><span class="archive-list-count">12</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">三月 2016</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">十二月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">十一月 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">十月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">九月 2015</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">八月 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">六月 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/05/">五月 2015</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/04/">四月 2015</a><span class="archive-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2017/05/12/duoshuoAnnouncement/">多说评论系统将停止提供服务</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewScritps/">Paraview 脚本一例</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewCamera/">Paraview 中有关 Camera 的操作两例</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewCustomFilter/">Paraview 中创建 Custom Filter</a>
          </li>
        
          <li>
            <a href="/2016/08/27/ParaviewStreamLineOnSlice/">在 Paraview 中画截面上的流线</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2017 Giskard Q.<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

<script src="//dn-lbstatics.qbox.me/lbservice/busuanzi/2.0/busuanzi.mini.js"/></script>

    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
    <a href="/atom.xml" class="mobile-nav-link">Rss</a>
  
    <a href="/about" class="mobile-nav-link">About</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css">
  <script src="/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script>


<script src="/js/script.js" type="text/javascript"></script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-62501686-1', 'auto');
  ga('send', 'pageview');

</script>

  </div>
<!-- mathjax config similar to math.stackexchange -->

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true
    }
  });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for(i=0; i < all.length; i += 1) {
            all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
</body>
</html>